package com.panda.sports.manager.query;

import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.panda.sports.manager.constant.Constant;
import com.panda.sports.manager.entity.StandardSportTeam;
import com.panda.sports.manager.entity.StandardSportTournament;
import com.panda.sports.manager.entity.ThirdSportTeam;
import com.panda.sports.manager.entity.ThirdSportTournament;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;

import java.util.ArrayList;
import java.util.List;

/**
 * @author :  Alair
 * @Project Name :  panda_data_service
 * @Package Name :  com.panda.sports.manager.query
 * @Description :  球队查询条件
 * @Date: 2019-08-13 14:26
 * @ModificationHistory Who    When    What
 * --------  ---------  --------------------------
 */
@Data
@Slf4j
@ApiModel(description = "球队查询条件")
public class SportTeamQuery {

    public static List<String> DATA_SOURCE_LIST = new ArrayList<>();

    static {
        DATA_SOURCE_LIST.add(Constant.DATA_SOURCE_SR);
        DATA_SOURCE_LIST.add(Constant.DATA_SOURCE_BC);
    }

    /**
     * 每页数据个数
     **/
    @ApiModelProperty(name = "每页数据量，默认50")
    private Integer size = 50;

    /**
     * 从第几页开始
     **/
    @ApiModelProperty(name = "从第几页开始，默认1")
    private Integer page = 1;

    @ApiModelProperty("体育种类Id（一期只有足球篮球）")
    private Long sportTypeId;

    @ApiModelProperty("数据来源列表")
    private List<String> dataSourceCode;

    @ApiModelProperty("地区id")
    private Long sportRegionId;

    @ApiModelProperty(name = "联赛ID状态", allowableValues = "range[0,1]", notes = "联赛ID状态.0:无联赛ID; 1:有联赛ID; 其余值:全部")
    private Integer tournamentManagerIdStatus;

    @ApiModelProperty("球队名")
    private String sportTeamName;

    @ApiModelProperty("球队ID")
    private Long sportTeamId;

    /**
     * 根据查询条件获取 标准wrapper
     * @description 根据查询条件获取 标准wrapper
     * @param query
     * @return com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper<com.panda.sports.manager.entity.StandardSportTeam>
     * @author Alair
     * @date 2019/8/19 20:34
     **/
    private static UpdateWrapper<StandardSportTeam> getStandardWrapper(SportTeamQuery query) {
        UpdateWrapper<StandardSportTeam> updateWrapper = new UpdateWrapper<StandardSportTeam>();
        return updateWrapper;
    }

    /**
     * 根据查询条件获取 第三方wrapper
     * @description 根据查询条件获取 第三方wrapper
     * @param query 查询条件
     * @return com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper<com.panda.sports.manager.entity.ThirdSportTeam>
     * @author Alair
     * @date 2019/8/19 20:32
     **/
    private static UpdateWrapper<ThirdSportTeam> getThirdWrapper(SportTeamQuery query) {
        UpdateWrapper<ThirdSportTeam> updateWrapper = new UpdateWrapper<ThirdSportTeam>();
        return updateWrapper;
    }


    /**
     * 根据查询条件获取wrapper
     * @description 根据查询条件获取wrapper
     * @param clas 类型，标准 / 第三方
     * @param query 查询条件
     * @return com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper
     * @author Alair
     * @date 2019/8/19 20:32
     **/
    public static UpdateWrapper getWrapper(Class<?> clas, SportTeamQuery query) {
        if (clas.equals(StandardSportTeam.class)) {
            log.info(clas.getName());
            return getStandardWrapper(query);
        }
        if (clas.equals(ThirdSportTeam.class)) {
            log.info(clas.getName());
            return getThirdWrapper(query);
        }
        return null;
    }
}
